This instructs postfix to use a third party SMTP server. It’s useful when you want to relay e-mail from an internal server which uses a dynamic IP address.
Ensure postfix is installed, and let’s have all e-mail sent to root relay to an external e-mail address:
[bash]nano /etc/postfix/sender_canonical[/bash]
[text]root youremail@provider.tld[/text]
Postfix requires the modifications to be hashed:
[bash]postmap hash:/etc/postfix/sender_canonical postconf -e "sender_canonical_maps=hash:/etc/postfix/sender_canonical"[/bash]
Now let’s instruct postfix to use third party SMTP to route e-mail:
[bash] nano /etc/postfix/main.cf relayhost = yoursmtp.provider.tld service postfix restart[/bash]
Finally update system aliases:
[bash] nano /etc/aliases root: email@domain.tld newaliases[/bash]